<table border="0" align="center" cellpadding="0" cellspacing="1" class="navi">
  <tr>
    <th>当前位置：分享品牌组别管理</th>
  </tr>
</table>
<script type="text/javascript">
var base = <?=json_encode(SystemProperties::$app_host)?>;

function shareGroupAddProduct(guid){
	var addpid = document.getElementById('addpid_'+guid).value;
	window.location.href = base+"/user/shareGroupAddProduct/"+guid+'/'+addpid;
}
function shareGroupDeleteProduct(guid,pid){
    if (confirm('确认删除?')) {
	   window.location.href = base+"/user/shareGroupDeleteProduct/"+guid+'/'+pid;
    }
}
function shareGroupChangeOrder(guid){
	var userpass = document.getElementById('editpass_'+guid).value;
	window.location.href = base+"/user/shareGroupChangeOrder/"+guid+'/'+userpass;
}
function shareGroupDelete(guid){
    if (confirm('确认删除?')) {
	   window.location.href = base+"/user/shareGroupDelete/"+guid;
    }
}

</script>
<table border="0" align="center" cellpadding="0" cellspacing="1" class="list">
<tr>
<td>
<div style="padding:10px">
<strong>增加分享品牌  (请注意自行控制图片大小，先调整尺寸后再上传，尺寸约112x32)</strong><br />
<form action="<?=SystemProperties::$app_host?>/user/shareGroupAdd" method="POST" enctype="multipart/form-data">
图片：<input type="file" name="photo" id="photo"> &nbsp;&nbsp;&nbsp;<br />
顺序（数字，从小到大排）：<input type="text" name="order" id="order"> &nbsp;&nbsp;&nbsp;<br />
<input class="comment_btn_Submit"  type="submit"  value="增加" />
</form>
<br /><br /><br />
<strong>管理品牌</strong> <br /><br />
<?php foreach ($sharedata as $share) { 
	$da = $share['g_sharegroups'];
	$pids = explode(',',$da['pids']);
	
	?>
	<br /><br />
	<table cellpadding="0" cellspacing="0">
	<tr>
	<td>图片：</td><td> <strong><img src="<?=$img_url?><?=$da['pic']?>" width="120" /></strong>
	<a href="javascript:shareGroupDelete('<?=$da['id'] ?>')"> [删除]</a>
	</td>
	</tr>
	<tr>
	<td>排序：</td><td> <strong><?=$da['order']?></strong></td>
	</tr>	
	<tr>
	<td>当前关联可查看产品：</td>
	<td>
	<?php 
	
	if (!empty($pids)){
		$i=0;
		foreach ($pids as $p){
			if (empty($p)){
				continue;
			}
			$i++;
			if ($p < 0){
				$pinfo = $Change->selectProduct(-$p);
				$pinfo[0]['g_products'] = $pinfo[0]['g_changes'];
			} else {
				$pinfo = $Product->selectProduct($p);
			}
			?>
			<strong><?=$p?></strong>（<?=$pinfo[0]['g_products']['g_name']?>）<a href="javascript:shareGroupDeleteProduct('<?=$da['id'] ?>',<?=$p?>)"> [删除]</a><br />
			<?php 
		}
	}
	?>
	</tr>
	<tr>
	<td>增加产品（ID）：</td><td><input type="text" name="addpid" id="addpid_<?=$da['id'] ?>"><input onclick="shareGroupAddProduct('<?=$da['id'] ?>')" type="button" class="comment_btn_Submit" value="增加关联产品(换宝id为负值)" /></td>
	</tr>
	<tr>
	<td>修改排序：</td><td><input type="text" name="editpass" id="editpass_<?=$da['id'] ?>"><input onclick="shareGroupChangeOrder('<?=$da['id'] ?>')" type="button"  class="comment_btn_Submit" value="修改" /></td>
	</tr>
	</table>
	
	
<?php } ?>

</div>
</td>
</tr>
</table>


